<?php
function check_runing($script_name="",$max_num=1){
	if(DS=="/"){
		if($script_name=="")
			$script_name=$_SERVER['SCRIPT_FILENAME'];
		$cmd="ps -ef |grep ".$script_name ." |grep -v grep";
		exec($cmd,$arr);
		$run_num=0;
		foreach($arr as $k=>$v){
			if(strpos($v,$script_name)===false){
				continue;
			}else{
				$run_num++;
                if($run_num>$max_num){
                    echo "runing";
                    exit;
                }
            }
		}
	}
}
function c ($str){
	echo $str."\r\n----------------------------\r\n";
}
function check_work_time($check=true){
	if($check==true){
		if(date("N")<6){
			$hour=date("H");
			if($hour>9 && $hour<18){
				echo "it is work time!\r\n";
				exit;
			}
		}
	}
}
function microtime_float()
{
    list($usec, $sec) = explode(" ", microtime());
    return ((float)$usec + (float)$sec);
}
function replace_blank($str){
	return str_replace("&nbsp;","",$str);
}
function logs($str,$file="log.txt"){
    file_put_contents($file,$str."\r\n--------------\r\n",FILE_APPEND);
}
?>